//
//  ChoiceTableViewCell.m
//  Choice
//
//  Created by A-01 on 2020/6/16.
//  Copyright © 2020 Mac. All rights reserved.
//

#import "ChoiceTableViewCell.h"

@implementation ChoiceTableViewCell


- (instancetype)initWithStyle:(UITableViewCellStyle)style reuseIdentifier:(NSString *)reuseIdentifier{
    
    if ([super initWithStyle:style reuseIdentifier:reuseIdentifier]) {
        
        [self setupUI];
    }
    
    return self;
}


- (void)setupUI{

    self.selectionStyle = UITableViewCellSelectionStyleNone;
    self.backgroundColor = ZRWhiteColor;
    
    UIView * backView = [[UIView alloc] initWithFrame:CGRectMake(24, 8, kScreenW - 48, 48)];
    
    backView.layer.cornerRadius = 10;
    backView.layer.masksToBounds = YES;
    
    self.backView = backView;
    
    [self.contentView addSubview:backView];
    
    
    UIImageView * addImageView = [UIImageView new];
    
    addImageView.image = [UIImage imageNamed:@"add"];
    addImageView.hidden = YES;
    
    self.addImageView = addImageView;
    
    [self.contentView addSubview:self.addImageView];
    
    
    UILabel * titleLabel = [UILabel new];
    
    titleLabel.textColor = ZRBlackColor;
    titleLabel.textAlignment = NSTextAlignmentCenter;
    titleLabel.hidden = YES;
    
    self.titleLabel = titleLabel;
    
    [self.contentView addSubview:self.titleLabel];
}

- (void)layoutSubviews{
    
    [self.addImageView mas_makeConstraints:^(MASConstraintMaker *make) {
        make.centerX.centerY.mas_equalTo(self.backView);
        make.width.height.mas_equalTo(24);
    }];
    
    [self.titleLabel mas_makeConstraints:^(MASConstraintMaker *make) {
        make.centerX.centerY.mas_equalTo(self.backView);
    }];
}

- (void)awakeFromNib {
    [super awakeFromNib];
    // Initialization code
}

- (void)setSelected:(BOOL)selected animated:(BOOL)animated {
    [super setSelected:selected animated:animated];

    // Configure the view for the selected state
}

@end
